package self.hoy.demo.cloud.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import self.hoy.demo.cloud.entities.CommonResult;
import self.hoy.demo.cloud.entities.Payment;
import self.hoy.demo.cloud.service.PaymentFeignService;

import javax.annotation.Resource;

/**
 * @author 三共小不
 * @date 2020/5/29
 */
@RestController
@Slf4j
public class OrderFeignController {

    @Resource
    private PaymentFeignService paymentFeignService;


    @GetMapping("/consumer/payment/get/{id}")
    public CommonResult<Payment> loadBalance(@PathVariable("id") Long id) {
        CommonResult<Payment> response = paymentFeignService.getPaymentById(id);
        return response;
    }

    @PostMapping("/consumer/payment/create")
    public CommonResult create(@RequestBody Payment payment){
        CommonResult<Payment> response = paymentFeignService.create(payment);
        return response;
    }

    @GetMapping("/consumer/payment/timeout")
    public String timeout() {
        return paymentFeignService.timeout();
    }
}
